package scrabble.view;
import scrabble.models.*;
import scrabble.config.*;

/**
 * Classe permettant l'affichage du plateau
 * 
 * @author Hadrien Luttiau
 *
 */
public class ASCIIView {

	public void displayView(Player p1, Player p2, Grid grid, boolean affBonus)
	{
		System.out.println("   0 1 2 3 4 5 6 7 8 9 A B C D E	[A = 10][B = 11][C = 12][D = 13][E = 14]");
		for (int i=0 ; i<Config.GRID_HEIGHT ; i++) {
			System.out.printf("%02d ",i);
			for (int j=0 ; j<Config.GRID_WIDTH ; j++) {
				if (grid.getGrid()[i][j] != null)
					if(grid.getGrid()[i][j] instanceof Bonus)
						if(affBonus)
							System.out.print(grid.getGrid()[i][j]+" ");
						else
							System.out.print(". ");
					else
						System.out.print(grid.getGrid()[i][j]+" ");
				else
					System.out.print(". ");
			}
			
			if ( i==6) {
				System.out.printf("%02d",i);
				System.out.println("	Player "+p1.getName()+" scored "+p1.getPoints()+" points.");
			}
				
			else if ( i==8) {
				System.out.printf("%02d",i);
				System.out.println("	Player "+p2.getName()+" scored "+p2.getPoints()+" points.");
			}
			else
				System.out.printf("%02d\n",i);
				
		}
		System.out.println("   0 1 2 3 4 5 6 7 8 9 A B C D E	[A = 10][B = 11][C = 12][D = 13][E = 14]");
	}
}
